package com.haha.helloworld.datastorage;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.haha.helloworld.R;

public class DataStorageActivity extends AppCompatActivity implements View.OnClickListener {
    private Button sharedPreferences_Button;
    private Button file_Button;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_data_storage);
        sharedPreferences_Button=(Button) findViewById(R.id.sharedPreferences_Button);
        file_Button=(Button) findViewById(R.id.file_Button);
        sharedPreferences_Button.setOnClickListener(this);
        file_Button.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        Intent intent=null;
        switch (v.getId()){
            case R.id.sharedPreferences_Button:
                //点击按钮跳转
                intent=new Intent(DataStorageActivity.this,SharedPreferencesActivity.class);
                startActivity(intent);
                break;
            case R.id.file_Button:
                intent=new Intent(DataStorageActivity.this,FileActivity.class);
                startActivity(intent);
                break;
        }
    }
}
